import request from '@/utils/request'
import { setInfo } from '../modules/user'


// 3. 异步action
export const getUserAction = (payload) => {
  return async (dispatch, getState) => {
    console.log('getState:', getState().login.token)
    const { data } = await request.get('/user/profile', {
      headers: {
        Authorization: `Bearer ${getState().login.token}`
      }
    })
    console.log('data', data.data)
    dispatch(setInfo(data.data))
  }
}